import { dateTransToSeoulTime } from '@/utils/util';

export const useMyDateRange = (options: any) => {
  const dateTimeRange: any = ref([]);

  onMounted(() => {
    dateTimeRange.value = options.dateTimeRange.map((item: any) => new Date(item * 1000));
  });

  const dateTimeRangeChange = (data: any) => {
    options.searchForm.start_ts = dateTransToSeoulTime(data[0]);
    options.searchForm.end_ts = dateTransToSeoulTime(data[1]);
  };

  return {
    dateTimeRange,
    dateTimeRangeChange
  };
};
